import java.util.Locale;
import java.util.Scanner;

public class Text4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        int count=0;
        s1=s1.toLowerCase();
        s2=s2.toLowerCase();

        char[] arr = s1.toCharArray();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]==s2.charAt(0)){
                count++;
            }
        }

        System.out.println(count);
    }
}
